//
//  YFCommunicationManager+YFBQHandle.h
//  SquashSpark
//
//  Created by Coollang on 2018/2/9.
//  Copyright © 2018年 Coollang-YF. All rights reserved.
//

#import "YFCommunicationManager.h"

@class YFDayRecordItem,YFSwingDetailItem,YFThreeDItem;

//hand:0→right 1→left
typedef void(^HandDataBlock)(BOOL success, NSString *hand);
typedef void(^VersionBlock)(BOOL versionSuccessful, NSString *version,NSInteger battery);

/*
 actionType:动作类型  speed:挥拍速度  strength:挥拍力量,swingTime:挥拍时间ms hitBallTime:击球时间ms  isHitBall: 有没有击中球 areaValue:击球区域   handType: 正反手 serveDirectionType: 出球方向 handBallType：上下手 timeStamp：时间戳
 */
typedef void(^RunTimeDataBlock)(BOOL success, SportPoseType actionType,NSInteger speed,float strength,NSInteger swingTime,NSInteger hitBallTime,BOOL hitball,NSInteger areaValue,HandDirectionType handType,ServeDirectionType serveDirectionType,JCHandBallType handBallType,NSTimeInterval timeStamp);

typedef void(^HomePageDataBlock)(NSArray <YFDayRecordItem *>*sportRecordItems,NSError *error);
typedef void(^SwingDetailItemBlock)(YFSwingDetailItem *swingDetailItem,NSError *error);
typedef void(^ThreeDItemBlock)(YFThreeDItem *threeDitem,NSError *error);

@interface YFCommunicationManager (YFBQHandle)

// 判断手机蓝牙是否开启
- (BOOL)isCentralReady;


/**
 * Get the Battery and version number of the device
 */
- (void)getDeviceVersionAndBatteryDatawithCompletion:(VersionBlock)block;

/**
 * Set left and right hand： 0->right 1-> left
 */
- (void)setDeviceHandType:(HandDirectionType)handType completion:(HandDataBlock)block;

/** Enter Real-time Model
 *
 * param enterStateBlock:Enter the real-time mode of successful callback block
 * param block:Real-time data callback block
 */
- (void)enterRealTimeModel:(BleCompletionBlock)enterStateBlock realTimeDataCallBlock:(RunTimeDataBlock)block;
/**
 * Quit Real-time Model
 */
- (void)quitRealTimeModelCompleted:(void(^)(BOOL success))completed;

/**
 * Get home page data
 **Note:
 DEVICE terminal to receive a complete APP "OperationTypeReadHomePageData instructions", will return to the last 10 days of data, that is, 10 groups of data packets.
 */
- (void)getHomePageDataWithCallBlock:(HomePageDataBlock)block;
// 获取详情数据
/**
 * Get swing details data
 *
 * param dayUnixTimeStamp :Corresponds to a day of data
 * param indexJ : Read from the indexJth, until the end
 */
- (void)getSwingDetailItemWithDay:(NSTimeInterval)dayUnixTimeStamp indexJ:(NSUInteger)indexJ CallBlock:(SwingDetailItemBlock)swingDetailBlock readCompleted:(void(^)(BOOL success))completed;

- (void)enter3DModel:(BleCompletionBlock)enterStateBlock swing3DDataCallBlock:(ThreeDItemBlock)threeDItemBlock;

@end
